import socket s = socket.socket() host = socket.gethostname() port = 12345 s.bind((host,port)) s.listen(5) while True: (c, address) = s.accept() print('Got a connection from ', address) c.send('Thank you for connecting'.encode('ascii')) c.close()